package accidence;

import org.junit.Test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 * 取近似值
 *
 * @author sdm
 * @version 1.0
 * @date 2023/3/17 8:46
 */
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class HJ7 {

    @Test
    public void MyHJ7(){
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case

            int res = 0;
            float b = 1f;
            float a = in.nextFloat();


            if (a > 0) {
                float intgerPalace = (int) Math.floor(a);
                float decimalsPalace = a - intgerPalace;

                if (decimalsPalace >= 0.5) {
                    res = (int) Math.ceil(a);
                    System.out.println(res);
                } else {
                    res = (int) Math.floor(a);
                    System.out.println(res);
                }
            } else {
                break;
            }
        }
    }

    @Test
    public void HJ71() throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        int index = str.indexOf(".");
        int a = Integer.parseInt(str.substring(0,index));
        int b = Integer.parseInt(str.substring(index+1,index+2));
        if(b >= 5){
            System.out.println(a+1);
        }else{
            System.out.println(a);
        }
    }


    @Test
    public void HJ72() {
        Scanner in = new Scanner(System.in);
        float a = in.nextFloat();
        System.out.println((int)(a+0.5));
    }


}
